package DuTriang;

public class DuTriang {
	int strlen;
	public void printTriangle(int len,String s){
		int totolen = len*s.length()+len-1;
		
		
		int relatlen = (s.length()+1)/2;
		int olen = totolen/(relatlen*2);
		int spacelen = totolen/2-s.length()/2;
		int i=1,j=0,k=0;
		
		for(i=1;i<=olen;i++){
			
			for(j=0;j<spacelen;j++){
				System.out.print(" ");
				}
			for(k=0;k<i;k++){
				System.out.print(s+" ");
				
			}
			  spacelen = spacelen-relatlen;
			  System.out.println();
			
		}
		
		
	}
	public static void main(String args[]){
		DuTriang dt = new DuTriang();
		java.util.Scanner sca = new java.util.Scanner(System.in);
		System.out.println("Please input the number of words in the last line:");
		int lineNumber = sca.nextInt();
		System.out.println("Please input the words that you want to constiute the tower!");
		String strWord = sca.next();
		dt.printTriangle(lineNumber, strWord);
	}
	
}
